<template>
	<view class="uni_box home">
		<!-- <navbar title='明星法务'>
		</navbar> -->
		<view class="fone">
			<image class="img_fx" src="/static/img/mingbg.png"></image>
			<view class="foneview">
				<u-icon name="arrow-left" class="fan" color="#333" size="40" @click="getfan"></u-icon>
				<text class="hmiao">明星法务</text>
			</view>
		</view>
		<view class="glone">
			<view class="glxin">
				<image class="hebg" :src="info.img"></image>
				<view class="xinleft">
					
					<view class="xinname">
						<text class="xshui">{{ info.name }}</text>
						<view class="congye">
							<image class="icon_rz" src="/static/img/icon_rz.png"></image>
							<text class="zhiye">执业{{info.life}}年</text>
						</view>
					</view>
					<view class="di">
						<text class="dimiao">{{info.province+info.city+info.area}}</text>
					</view>
					<text class="suomiao">所在律所：{{info.law_firm}}</text>
					<text class="suomiao">执业证号：{{info.number}}</text>
				</view>
				

			</view>
			<view class="glei">
				<view class="leiitem" v-for="(item,index) in info.labels">{{item}}</view>
			</view>
		</view>
		<view class="content">
			<view class="gltwo">
				<text class="zitit">资历介绍</text>
				<u-parse  class="miao" :html="info.qualification" :tag-style="style"></u-parse>
				<!-- <text class="miao">{{info.qualification}}</text> -->
			</view>
			<view class="gltwo">
				<text class="zitit">详情描述</text>
				<u-parse  class="miao" :html="info.content" :tag-style="style"></u-parse>
				<!-- <text class="miao">{{info.content}}</text> -->
			</view>
		</view>

		<view class="botview">
			<!-- <view class="botbtn" @click="getshenqing">申请委托</view> -->
			<view class="quxiaoviewthree">
				<view class="shifu" v-if="vinfo.is_vip==0">
					<view class="fuone">
						<text class="sname">沟通次数：</text>
						<text class="fujia">{{vinfo.surplus}}/{{ vinfo.total }}</text>
					</view>
					<text class="jiaru">加入会员免费下载</text>
				</view>
				<view class="rbtn"  :class="vinfo.is_vip==1?'newshen':''">
					<view class="popquview" @click="gethuiyuan()" v-if="vinfo.is_vip==0">开通会员</view>
					<view class="popquview quebtn" :class="vinfo.is_vip==1?'newshen':''" @click="wxshow = true">申请咨询</view>
				</view>
			</view>
		</view>

		<!-- 申请咨询弹窗 -->
		<!-- 温馨底层 -->
		<view class="yhupopview">
			<u-popup v-model="wxshow" mode="bottom" @close="popclose(2)" width="100%" :closeable="true" z-index="1000">
				<view class="yhpop">

					<text class="yhtit">
						申请成功
					</text>
					<text class="bmiao">请保存并扫码添加顾问</text>
					<image class="wenxin" :src="info.wechat_code" />
					<view class="quxiaoviewtwo">
						<!-- #ifdef APP-PLUS -->
						<view class="popquview quebtn" @click="baocun(2)">保存到相册</view>
						<!-- #endif -->
						<!-- #ifdef H5 -->
						<view class="popquview quebtn" @click="baocun(2)">查看二维码</view>
						<!-- #endif -->
					</view>
				</view>
			</u-popup>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				info:{},
				style: {
						img: 'width:max-width:100%;height:auto;pointer-events: none;'
				},
				vinfo:{},
				wxshow:false
			}
		},
		onLoad(option) {
			this.id = option.id
			this.getDetail()
		},
		onShow() {
		},
		methods: {
			async getDetail(){
				let res = await this.$u.api.lawyerinfo({
					id:this.id
				});
				this.info = res.info
				this.vinfo.surplus=res.surplus
				this.vinfo.is_vip=res.is_vip
				this.vinfo.total=res.total
			},
			getfan(){
				uni.navigateBack()
			},
			gethuiyuan(){
				this.navrouter("/pages/TPage/VIpServices");
			},
			popclose(){
				this.wxshow = false
			},
			baocun() {
				//保存相册
				// #ifdef APP-PLUS
				this.loadBase64Url()
				// #endif
				// #ifdef H5
				// uni.showToast({
				// 	title: '请截图保存相册',
				// 	icon: 'none',
				// 	duration: 1000
				// });
				let shuzu = []
				shuzu.push(this.info.wechat_code)
				uni.previewImage({
					current: this.info.wechat_code, // 当前显示图片的 http 链接
					urls: shuzu // 需要预览的图片 http 链接列表
				});
				// #endif
				},
				loadBase64Url() {
					this.saveImage(this.info.wechat_code)
				},
				// 保存图片到手机相册
				saveImage(filePath) {
					let that = this
					uni.saveImageToPhotosAlbum({
						filePath, // 需要临时文件路径，base64无法保存
						success: () => {
						uni.showToast({
							title: '保存图片成功',
							icon: 'none',
							duration: 1000
						});
						},
						fail: () => {
						uni.showToast({
							title: '保存失败，请重试',
							icon: 'none',
							duration: 1000
						});
						}
					});
				},
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.fone{
		position: relative;
		height: 480rpx;
		.img_fx{
			position: absolute;
			width: 100%;
			height: 100%;
		}
		.foneview{
			position: relative;
			padding: 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: center;

		}
		.fan{
		   position: absolute;
		   left: 30rpx;
		}
		.hmiao{
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 40rpx;
			color: #111111;
		}
	}

	.content{
		background-color: #fff;
		min-height: 100vh;
		padding-bottom: 150rpx;
		
		
		// .gline{
		// 	background: #EEEEEE;
		// 	height: 10rpx;
		// 	position: relative;
		// }
		.gltwo{
			padding: 30rpx 40rpx;
			margin-bottom: 60rpx;
			.zitit{
				display: block;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 28rpx;
				color: #111111;
				margin-bottom: 20rpx;
			}
			.miao{
				font-family: PingFang SC;
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
			}
		}
	}
	.glone{
		// border-top: 10rpx solid #eee;
		// border-bottom: 10rpx solid #eee;
		display: flex;
		flex-direction: column;
		padding: 30rpx 40rpx;
		margin: -320rpx 30rpx 30rpx;
		position: relative;
		z-index: 10;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 24rpx 0rpx rgba(204,204,204,0.5);
		border-radius: 20rpx;
		.glxin{
			display: flex;
			flex-direction: row;
			align-items: center;
			.xinleft{
				display: flex;
				flex-direction: column;
				flex: 1;
				margin-left: 30rpx;
				.xinname{
					display: flex;
					flex-direction: row;
					align-items: center;
					.xshui{
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 36rpx;
						color: #333333;
					}
					.congye{
						display: flex;
						align-items: center;
						flex-direction: row;
						padding: 6rpx 12rpx;
						background: #E2FEF5;
						border-radius: 16rpx;
						margin-left: 20rpx;
						.icon_rz{
							width: 26rpx;
							height: 26rpx;
							margin-right: 13rpx;
						}
						.zhiye{
							font-family: PingFang SC;
							font-weight: bold;
							font-size: 20rpx;
							color: #34C99C;
						}
					}
				}
				.di{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #666666;	
					display: block;
					margin: 20rpx 0 10rpx;
				}
				.suomiao{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #666666;
					display: block;
					margin-bottom: 4rpx;
				}
			}
			.hebg{
				
				width: 150rpx;
				height: 150rpx;
				border-radius: 10rpx;
			}
		}
		.glei{
			margin-top: 30rpx;
			display: flex;
			flex-direction: row;
			.leiitem{
				padding: 11rpx 14rpx;
				border-radius: 5rpx;
				border: 1px solid #CCCCCC;
				margin-right: 10rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 20rpx;
				color: #999999;
			}
		}
	}
	.botview{
			position: fixed;
			width: 100%;
			height: 120rpx;
			background-color: #fff;
			bottom: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			.quxiaoviewthree{
				display: flex;
				flex-direction: row;
				// margin-top: 40rpx;
				padding: 0 20rpx;
				width: 100%;
				.shifu{
					display: flex;
					flex-direction: column;
					.fuone{
						display: flex;
						flex-direction: row;
						align-items: center;
						.sname{
							font-family: PingFang SC;
							font-weight: 500;
							font-size: 25rpx;
							color: #999999;
						}
						.fujia{
							font-weight: bold;
							font-size: 28rpx;
							color: #3E65E5;
							position: relative;
							top: -4rpx;
						}
						.funum{
							font-size: 40rpx;
						}
					}
					.jiaru{
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
					}
				}
				.rbtn{
					width: 60%;
					display: flex;
					flex-direction: row;
					justify-content: flex-end;
					margin-left: auto;

				}

				.popquview{
					height: 80rpx;
					border-radius: 10rpx;
					background: linear-gradient(90deg, #F4DAB5, #E7B775);
					border-radius: 10rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					width: 40%;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 26rpx;
					color: #52360F;
				}
				.quebtn{
					background: #3E65E5;
					color: #fff;
					border: 1rpx solid #3E65E5;
					margin-left: 20rpx;
				}
				.newshen{
					width: 100%;
				}
			}
	}	
	
	.yhupopview{
		/deep/.u-mode-center-box{
			background-color: transparent;
		}
		.yhpop{
			border-radius: 24rpx;
			padding: 40rpx;
			background-color: #fff;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;

			.yhtit{
				display: block;
				text-align: center;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
				margin-bottom: 45rpx;
			}
			.wenxin{
				width: 400rpx;
				height: 400rpx;
				border-radius: 10rpx;

			}
			.wenmiao{
				display: block;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #333333;
				margin: 30rpx 0;
			}
			.tishibg{
				width: 300rpx;
				height: 240rpx;
			}
			.anshou{
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color: #333333;
				display: block;
				margin: 20rpx 0;
			}
			.pinput{
				background: #F5F5F5;
				border-radius: 10rpx;
				padding:10rpx 20rpx;
				margin-bottom: 20rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
			}
			.huoqu{
				margin-left: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #496EE7;
			}
			.quxiaoviewtwo{
				display: flex;
				flex-direction: row;
				margin-top: 40rpx;
				justify-content: center;
				width: 100%;
				.popquview{
					height: 90rpx;
					border-radius: 10rpx;
					border: 1rpx solid #111111;
					display: flex;
					align-items: center;
					justify-content: center;
					width: 90%;
				}
				.quebtn{
					background: #3E65E5;
					color: #fff;
					border: 1rpx solid #3E65E5;
				}
			}
			.quxiaoviewtwo{
				display: flex;
				flex-direction: row;
				margin-top: 40rpx;
				justify-content: space-between;
				width: 100%;
				.popquview{
					height: 90rpx;
					border-radius: 10rpx;
					border: 1rpx solid #111111;
					display: flex;
					align-items: center;
					justify-content: center;
					width: 100%;
				}
				.quebtn{
					background: #3E65E5;
					color: #fff;
					border: 1rpx solid #3E65E5;
				}
			}
		}
		.bmiao{
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #666666;
			display: block;
			margin-bottom: 30rpx;
		}
	}
</style>
